package demo.server;

import demo.server.controller.MessageTestController;
import net.jueb.protoServer.boot.ProtoServer;
import net.jueb.protoServer.message.ProtoMessage;
import net.jueb.protoServer.protocol.PortProtocol;
import net.jueb.protoServer.protocol.ProtoMessageProtocol;
import net.jueb.protoServer.portService.ProtoMessagePortService;
import net.jueb.protoServer.portService.TcpPortService;

public class Test {

	public static void main(String[] args) {
		//启动服务器
		ProtoServer server=new ProtoServer(100,"测试服务器");
		server.startServer();
		//创建自定义服务对象并加入服务器执行
		PortProtocol<ProtoMessage.Message> protocol=new ProtoMessageProtocol();
		TcpPortService<ProtoMessage.Message> ps=new ProtoMessagePortService(9999, "测试9999端口通讯的服务", protocol);
		server.addPortService(ps);
		//动态添加消息控制器
		ps.addController(new MessageTestController());
	}
}
